package cn.zzstudios.mat;

/*
* 矩阵泛型类，浮点数、复数、或者其他实现了需要的运算的类型
* */


interface MatCompatibleDataType<T> {
    public T add(T t);
    public void add_(T t);
    public T neg();
    public void neg_();
    public T sub(T t);
    public void sub_(T t);
    public T mul(T t);
    public void mul_(T t);
    public T div(T t);
    public void div_(T t);
}


public class Matrix< T extends MatCompatibleDataType<T> > {
    Matrix(){

    }

    public Matrix<T> add(Matrix<T> mt){
        return null;
    }

    public void add_(Matrix<T> tMatrix) {

    }

    public Matrix<T> neg() {
        return null;
    }

    public void neg_() {

    }

    public Matrix<T> sub(Matrix<T> tMatrix) {
        return null;
    }

    public void sub_(Matrix<T> tMatrix) {

    }

    public Matrix<T> mul(Matrix<T> tMatrix) {
        return null;
    }

    public void mul_(Matrix<T> tMatrix) {

    }

    public Matrix<T> scalarMul(T t) {
        return null;
    }

    public void scalarMul_(T t) {
        return;
    }

    public T det(){
        return null;
    }

    public Matrix<T> inv(){
        return null;
    }

    public Matrix<T> transpose(){
        return null;
    }

    public void transpose_(){

    }

    public String toString(){
        return null;
    }

}


class MatFloat implements MatCompatibleDataType<MatFloat> {

    MatFloat(){

    }

    @Override
    public MatFloat add(MatFloat matFloat) {
        return null;
    }

    @Override
    public void add_(MatFloat matFloat) {

    }

    @Override
    public MatFloat neg() {
        return null;
    }

    @Override
    public void neg_() {

    }

    @Override
    public MatFloat sub(MatFloat matFloat) {
        return null;
    }

    @Override
    public void sub_(MatFloat matFloat) {

    }

    @Override
    public MatFloat mul(MatFloat matFloat) {
        return null;
    }

    @Override
    public void mul_(MatFloat matFloat) {

    }

    @Override
    public MatFloat div(MatFloat matFloat) {
        return null;
    }

    @Override
    public void div_(MatFloat matFloat) {

    }
}

class Test{
    public static void test_matrix(){
        Matrix<MatFloat> X, Y;
        // read in data somehow ...
        X = new Matrix<>();
        Y = new Matrix<>();
        // ... some code to init X and Y
        Matrix<MatFloat> XT = X.transpose();
        XT.mul_(X);
        Matrix<MatFloat> beta = XT.inv().mul(XT).mul(Y);
        System.out.println(beta);  // will call toString() here
    }
}
